﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NRemedy;
using System.Diagnostics;
using BMC.ARSystem;
using AR.Entity;
using System.Collections;

namespace Wicresoft.EVM.Callback.Test
{
    [TestClass]
    public class ARServer_Test
    {
        [TestMethod]
        public void ARServer_ResolveFormName_Test1()
        {
            ASB_FormTest entry = new ASB_FormTest();
            ARServer server = new ARServer();
            Assert.AreEqual("ASB_FormTest",server.ResolveFormName(entry));
        }

        [TestMethod]
        public void ARServer_ResolveFormName_Test2()
        {
            ASB_FormTest2 entry = new ASB_FormTest2();
            ARServer server = new ARServer();
            Assert.AreEqual("ASB_FormTest2", server.ResolveFormName(entry));
        }

        [TestMethod]
        public void ARServer_ResolveFormField_Test1()
        {
            //
            ASB_FormTest entry = new ASB_FormTest();
            entry.Assigned_To = "parkerz.admin";
            entry.IntField = 1024;
            ARServer server = new ARServer();
            //
            IEnumerable<ARField> result = server.ResolveFormField(entry);
            //
            Assert.AreEqual<int>(6, result.Count());
            Assert.AreEqual<string>("parkerz.admin", result.First(field => field.DatabaseID == 4).Value.ToString());
            Assert.AreEqual(1024, result.First(field => field.DatabaseID == 536870916).Value);
        }

        [TestMethod]
        [ExpectedException(typeof(DuplicateDatabaseIDException),AllowDerivedTypes=false)]
        public void ARServer_ResolveFormField_Test2()
        {
            //
            ASB_FormTest2 entry = new ASB_FormTest2();
            entry.Assigned_To = "parkerz.admin";
            entry.Int_Field = 1024;
            ARServer server = new ARServer();
            //
            IEnumerable<ARField> result = server.ResolveFormField(entry);
            //
            Assert.AreEqual<int>(7, result.Count());
            Assert.AreEqual<string>("parkerz.admin", result.First(field => field.DatabaseID == 4).Value.ToString());
            Assert.AreEqual(1024, result.First(field => field.DatabaseID == 536870916).Value);
        }

        [TestMethod]
        public void ARServer_CreateEntry_Test1()
        {
            //
            ASB_FormTest entry = new ASB_FormTest();
            entry.Assigned_To = "parkerz.admin";
            entry.IntField = 1024;
            entry.Status = "Fixed";
            entry.StrField = "parkerz.admin test";
            entry.Short_Description = "not null";
            entry.Submitter = "parkerz.admin";
            IARServer server = ARServerFactory.CreateARServer();
            server.LogIn(new ARLogInRequestContext { 
                 UserName = "parkerz.admin",
                 Server = "vs31srm01",
                 Password = "admin",
                 Authentication = string.Empty
            });
            //
            string RequestID = server.CreateEntry(entry);
            
            //
            Debug.WriteLine(RequestID);
            ASB_FormTest entry2 = new ASB_FormTest();
            entry2.DefaultEntryKey = RequestID;
            server.GetEntry(entry2);
            server.LogOut();

            Assert.AreEqual<string>("parkerz.admin", entry2.Assigned_To);
            Assert.AreEqual<string>("parkerz.admin test", entry2.StrField);
            Assert.AreEqual<int>(1024, entry2.IntField);
            Assert.AreEqual<string>("Fixed", entry2.Status);
        }

        [TestMethod]
        public void ARServer_SetEntry_Test1()
        {
            //
            ASB_FormTest entry = new ASB_FormTest();
            entry.DefaultEntryKey = "000000000000003";

            FieldValueSet set = new FieldValueSet();
            set.Add("Str_Field" , "String Changed");
            set.Add("Int_Field" , 2048);

            IARServer server = ARServerFactory.CreateARServer();
            server.LogIn(new ARLogInRequestContext
            {
                UserName = "parkerz.admin",
                Server = "vs31srm01",
                Password = "admin",
                Authentication = string.Empty
            });
            //
            server.SetEntry(entry,set);

            //
            ASB_FormTest entry2 = new ASB_FormTest();
            entry2.DefaultEntryKey = entry.DefaultEntryKey;
            server.GetEntry(entry2);
            server.LogOut();

            Assert.AreEqual<string>("String Changed", entry2.StrField);
            Assert.AreEqual<int>(2048, entry2.IntField);
        }

        [TestMethod]
        public void ARServer_GetFields_Test1()
        {
            IARServer server = ARServerFactory.CreateARServer();
            server.LogIn(new ARLogInRequestContext
            {
                UserName = "parkerz.admin",
                Server = "vs31srm01",
                Password = "admin",
                Authentication = string.Empty
            });

            foreach (var f in server.GetListField("ASB_FormTest",null)){

                Debug.WriteLine(f.ToString() + " " + f.Id);
            }

            server.LogOut();
        }        
        
        [TestMethod]
        public void ARServer_GetEntry_Test2()
        {
            IARServer server = ARServerFactory.CreateARServer();
            server.LogIn(new ARLogInRequestContext
            {
                UserName = "parkerz.admin",
                Server = "vs31srm01",
                Password = "admin",
                Authentication = string.Empty
            });

            ASB_FormTest entry2 = new ASB_FormTest();
            entry2.DefaultEntryKey = "000000000000019";
            server.GetEntry(entry2);

            server.LogOut();
        }

        [TestMethod]
        public void ARServer_GetChangeListSince()
        {
            IARServer server = ARServerFactory.CreateARServer();
            server.LogIn(new ARLogInRequestContext
            {
                UserName = "parkerz.admin",
                Server = "vs31srm01",
                Password = "admin",
                Authentication = string.Empty
            });

            DateTime dtsince = new DateTime(2011, 10, 26);



            ArrayList exportItems = new ArrayList();


            var forms = server.Server.GetListForm(dtsince);
            Debug.WriteLine("Forms:");
            foreach (string form in forms)
            {
                Debug.WriteLine(string.Format("{0}", form));
                exportItems.Add(new StructureItem(Constants.AR_STRUCT_ITEM_SCHEMA, form, null));
            }

            var activeLinks = server.Server.GetListActiveLink(dtsince);
            Debug.WriteLine("ActiveLinks:");
            foreach (string activelink in activeLinks){
                Debug.WriteLine(string.Format("{0}", activelink));
                exportItems.Add(new StructureItem(Constants.AR_STRUCT_ITEM_ACTIVE_LINK, activelink, null));
            }

            var filters = server.Server.GetListFilter(dtsince);
            Debug.WriteLine("Filter:");
            foreach (string filter in filters){
                Debug.WriteLine(string.Format("{0}", filter));
                exportItems.Add(new StructureItem(Constants.AR_STRUCT_ITEM_FILTER, filter, null));
            }

            var menus = server.Server.GetListMenu(dtsince);
            Debug.WriteLine("Menus:");
            foreach (string m in menus)
            {
                Debug.WriteLine(string.Format("{0}", m));
            }

            //Debug.WriteLine("ActiveLinkGuild:");
            //Debug.WriteLine("ASB_vAppModifyCheckHostName");
            //Debug.WriteLine("ASB_vAppModifyGenerateHostName");

            server.Server.ExportDefinitions(@"c:\ii.def", exportItems, true, false);

            server.LogOut();
        }

        [TestMethod]
        public void ARServer_UpdateExpiredDate()
        {
            IARServer server = ARServerFactory.CreateARServer();
            server.LogIn(new ARLogInRequestContext
            {
                UserName = "parkerz.admin",
                Server = "vs31srm01",
                Password = "admin",
                Authentication = string.Empty
            });

            ASB_RealVMStore vmstore = new ASB_RealVMStore();
            vmstore.DefaultEntryKey = "000000000004797";
            FieldValueSet set = new FieldValueSet();
            set.Add("cDt_ExpiredDate",new DateTime(2011,11,1));
            set.Add("cChr_ExpiredDateChangeFlag","1");
            server.SetEntry(vmstore, set);

            server.GetEntry(vmstore);

            server.LogOut();
        }

        [TestMethod]
        public void ARServer_IPAddressesInit()
        {
            IARServer server = ARServerFactory.CreateARServer();
            server.LogIn(new ARLogInRequestContext
            {
                UserName = "parkerz.admin",
                Server = "vs31srm01",
                Password = "admin",
                Authentication = string.Empty
            });

            

            ASB_AdminIPConfig ip = new ASB_AdminIPConfig();

            ASB_RealVMStore vmstore = new ASB_RealVMStore();
            vmstore.DefaultEntryKey = "000000000004797";
            FieldValueSet set = new FieldValueSet();
            set.Add("cDt_ExpiredDate", new DateTime(2011, 11, 1));
            set.Add("cChr_ExpiredDateChangeFlag", "1");
            server.SetEntry(vmstore, set);

            server.GetEntry(vmstore);

            server.LogOut();
        }



        [TestMethod]
        public void Data_Maintain_In_2011_10_12()
        {
            IARServer server = ARServerFactory.CreateARServer();
            server.LogIn(new ARLogInRequestContext
            {
                UserName = "parkerz.admin",
                Server = "vs31ar03",
                Password = "admin",
                Authentication = string.Empty
            });


            ASB_RealVMStore vmstore = new ASB_RealVMStore();
            FieldValueSet set = new FieldValueSet();


            //11:
            vmstore.DefaultEntryKey = "000000000004867";
            set.Add("cChr_Owner", "paul hu");
            server.SetEntry(vmstore, set);
            set.Clear();


            //160:
            vmstore.DefaultEntryKey = "000000000004799";
            set.Add("cChr_Owner", "huai lu");
            server.SetEntry(vmstore, set);
            set.Clear();

            //161:
            vmstore.DefaultEntryKey = "000000000004820";
            set.Add("cChr_Owner", "long yue");
            server.SetEntry(vmstore, set);
            set.Clear();

            //163:
            vmstore.DefaultEntryKey = "000000000004832";
            set.Add("cChr_IPAddress1", "135.251.45.63");
            set.Add("cChr_Owner", "michael diao");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();




                        //16
            
                        vmstore.DefaultEntryKey = "000000000004985";
                        set.Add("cChr_IPAddress1", "135.251.44.110");
                        set.Add("cChr_Owner", "dong yang");
                        set.Add("Short_Description", DateTime.Now.ToString());
                        server.SetEntry(vmstore, set);
                        set.Clear();

            
                        //28
                        vmstore.DefaultEntryKey = "000000000004910";
                        set = new FieldValueSet();
                        set.Add("cChr_IPAddress1", "135.251.44.129");
                        set.Add("cChr_Owner", "liang ji");
                        set.Add("Short_Description", DateTime.Now.ToString());
                        server.SetEntry(vmstore, set);
                        set.Clear();

                        //31
                        vmstore.DefaultEntryKey = "000000000005311";
                        set = new FieldValueSet();
                        set.Add("cChr_IPAddress1", "135.251.44.133");
                        set.Add("Short_Description", DateTime.Now.ToString());
                        server.SetEntry(vmstore, set);
                        set.Clear();

                        //32
                        vmstore.DefaultEntryKey = "000000000004918";
                        set = new FieldValueSet();
                        set.Add("cChr_IPAddress1", "135.251.44.136");
                        set.Add("cChr_Owner", "ni yong");
                        set.Add("cChr_ResourcepoolID", "000000000002905");
                        set.Add("cChr_ResourcePoolDisplay", "ASB_PRD");
                        //set.Add("cChr_HostID","");
                        //set.Add("cChr_SelectedHostName","");
                        set.Add("tmp_Type", "PRD");
                        set.Add("Short_Description", DateTime.Now.ToString());
                        server.SetEntry(vmstore, set);
                        set.Clear();

                        //33
                        vmstore.DefaultEntryKey = "000000000004908";
                        set = new FieldValueSet();
                        set.Add("cChr_IPAddress1", "135.251.44.137");
                        set.Add("cChr_Owner", "liang ji");
                        set.Add("cChr_ResourcepoolID", "000000000002905");
                        set.Add("cChr_ResourcePoolDisplay", "ASB_PRD");
                        set.Add("tmp_Type", "PRD");
                        set.Add("Short_Description", DateTime.Now.ToString());
                        server.SetEntry(vmstore, set);
                        set.Clear();

                        //34
                        vmstore.DefaultEntryKey = "000000000004922";
                        set = new FieldValueSet();
                        set.Add("cChr_IPAddress1", "135.251.44.138");
                        set.Add("cChr_Owner", "liang ji");
                        set.Add("cChr_ResourcepoolID", "000000000002905");
                        set.Add("cChr_ResourcePoolDisplay", "ASB_PRD");
                        set.Add("tmp_Type", "PRD");
                        set.Add("Short_Description", DateTime.Now.ToString());
                        server.SetEntry(vmstore, set);
                        set.Clear();


                        //35
                        vmstore.DefaultEntryKey = "000000000004914";
                        set = new FieldValueSet();
                        set.Add("cChr_IPAddress1", "135.251.44.139");
                        set.Add("cChr_Owner", "liang ji");
                        set.Add("cChr_ResourcepoolID", "000000000002905");
                        set.Add("cChr_ResourcePoolDisplay", "ASB_PRD");
                        set.Add("tmp_Type", "PRD");
                        set.Add("Short_Description", DateTime.Now.ToString());
                        server.SetEntry(vmstore, set);
                        set.Clear();

                        //37::
                        vmstore.DefaultEntryKey = "000000000004907";
                        set = new FieldValueSet();
                        set.Add("cChr_IPAddress1", "135.251.44.142");
                        set.Add("cChr_Owner", "liang ji");
                        set.Add("cChr_ResourcepoolID", "000000000002905");
                        set.Add("cChr_ResourcePoolDisplay", "ASB_PRD");
                        set.Add("tmp_Type", "PRD");
                        set.Add("Short_Description", DateTime.Now.ToString());
                        server.SetEntry(vmstore, set);
                        set.Clear();

                        //38
                        vmstore.DefaultEntryKey = "000000000004906";
                        set = new FieldValueSet();
                        set.Add("cChr_IPAddress1", "135.251.44.143");
                        set.Add("cChr_ResourcepoolID", "000000000002905");
                        set.Add("cChr_ResourcePoolDisplay", "ASB_PRD");
                        set.Add("tmp_Type", "PRD");
                        set.Add("Short_Description", DateTime.Now.ToString());
                        server.SetEntry(vmstore, set);
                        set.Clear();

                        //41
                        vmstore.DefaultEntryKey = "000000000004888";
                        set = new FieldValueSet();
                        set.Add("cChr_Owner", "liang ji");
                        server.SetEntry(vmstore, set);
                        set.Clear();

                        //48
                        vmstore.DefaultEntryKey = "000000000004912";
                        set = new FieldValueSet();
                        set.Add("cChr_Owner", "ni yong");
                        set.Add("cChr_IPAddress1", "135.251.44.27");
                        set.Add("Short_Description", DateTime.Now.ToString());
                        server.SetEntry(vmstore, set);
                        set.Clear();


            //49:
            vmstore.DefaultEntryKey = "000000000004870";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "Michael Diao");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();


            //52
            vmstore.DefaultEntryKey = "000000000004829";
            set = new FieldValueSet();
            set.Add("cChr_Owner", @"NA02\JLWIKER;NA02\MRUSCH");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //57
            vmstore.DefaultEntryKey = "000000000004844";
            set = new FieldValueSet();
            set.Add("cChr_IPAddress1", "135.251.44.44");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();


            //59
            vmstore.DefaultEntryKey = "000000000004847";
            set = new FieldValueSet();
            set.Add("cChr_IPAddress1", "135.251.44.46");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //70
            vmstore.DefaultEntryKey = "000000000004897";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "rong f cui");
            set.Add("cChr_IPAddress1", "135.251.44.61");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //78
            vmstore.DefaultEntryKey = "000000000004944";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "liang ji");
            server.SetEntry(vmstore, set);
            set.Clear();

            //79
            vmstore.DefaultEntryKey = "000000000004941";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "liang ji");
            server.SetEntry(vmstore, set);
            set.Clear();

            //97
            vmstore.DefaultEntryKey = "000000000004984";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "Guoxiong TANG");
            server.SetEntry(vmstore, set);
            set.Clear();

            //99
            vmstore.DefaultEntryKey = "000000000005001";
            set = new FieldValueSet();
            set.Add("cInt_TotalCost", "5525");
            set.Add("cChr_IPAddress1", "135.251.45.103");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //100
            vmstore.DefaultEntryKey = "000000000005002";
            set = new FieldValueSet();
            set.Add("cChr_IPAddress1", "135.251.45.104");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();


            //101
            vmstore.DefaultEntryKey = "000000000005003";
            set = new FieldValueSet();
            set.Add("cInt_TotalCost", "5525");
            set.Add("cChr_IPAddress1", "135.251.45.105");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //102
            vmstore.DefaultEntryKey = "000000000005004";
            set = new FieldValueSet();
            set.Add("cInt_TotalCost", "5525");
            set.Add("cChr_IPAddress1", "135.251.45.106");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();


            //103
            vmstore.DefaultEntryKey = "000000000005005";
            set = new FieldValueSet();
            set.Add("cInt_TotalCost", "5525");
            server.SetEntry(vmstore, set);
            set.Clear();

            //106
            vmstore.DefaultEntryKey = "000000000004953";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "liang ji");
            server.SetEntry(vmstore, set);
            set.Clear();

            //111
            vmstore.DefaultEntryKey = "000000000004920";
            set = new FieldValueSet();
            set.Add("cChr_IPAddress1", "135.251.45.118");
            set.Add("cChr_Owner", "ni yong");
            set.Add("cChr_ResourcepoolID", "000000000002906");
            set.Add("cChr_ResourcePoolDisplay", "ASB_DEV");
            set.Add("tmp_Type", "DEV");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //112
            vmstore.DefaultEntryKey = "000000000004925";
            set = new FieldValueSet();
            set.Add("cChr_IPAddress1", "135.251.45.119");
            set.Add("cChr_Owner", "guoxiong tang");
            set.Add("cChr_ResourcepoolID", "000000000002906");
            set.Add("cChr_ResourcePoolDisplay", "ASB_DEV");
            set.Add("tmp_Type", "DEV");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //116
            vmstore.DefaultEntryKey = "000000000004812";
            set = new FieldValueSet();
            set.Add("cChr_IPAddress1", "135.251.45.15");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //122
            vmstore.DefaultEntryKey = "000000000004824";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "long yue");
            server.SetEntry(vmstore, set);
            set.Clear();

            //126
            vmstore.DefaultEntryKey = "000000000004842";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "liang ji");
            server.SetEntry(vmstore, set);
            set.Clear();

            //129
            vmstore.DefaultEntryKey = "000000000004987";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "yan b guo");
            server.SetEntry(vmstore, set);
            set.Clear();

            //130
            vmstore.DefaultEntryKey = "000000000004986";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "yan b guo");
            server.SetEntry(vmstore, set);
            set.Clear();

            //141
            vmstore.DefaultEntryKey = "000000000004803";
            set = new FieldValueSet();
            set.Add("cChr_IPAddress1", "135.251.45.36");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //143
            vmstore.DefaultEntryKey = "000000000004841";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "liang ji");
            server.SetEntry(vmstore, set);
            set.Clear();

            //158
            vmstore.DefaultEntryKey = "000000000004843";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "liang ji");
            server.SetEntry(vmstore, set);
            set.Clear();

            //168
            vmstore.DefaultEntryKey = "000000000004892";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "liang ji");
            server.SetEntry(vmstore, set);
            set.Clear();

            
            //169:
            vmstore.DefaultEntryKey = "000000000004834";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "michael diao");
            server.SetEntry(vmstore, set);
            set.Clear();

            //171:
            vmstore.DefaultEntryKey = "000000000004833";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "michael diao");
            server.SetEntry(vmstore, set);
            set.Clear();

            //172:
            vmstore.DefaultEntryKey = "000000000004835";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "michael diao");
            server.SetEntry(vmstore, set);
            set.Clear();


            //175
            vmstore.DefaultEntryKey = "000000000004942";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "liang ji");
            server.SetEntry(vmstore, set);
            set.Clear();

            //176
            vmstore.DefaultEntryKey = "000000000004930";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "liang ji");
            server.SetEntry(vmstore, set);
            set.Clear();

            //177
            vmstore.DefaultEntryKey = "000000000004931";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "liang ji");
            set.Add("cChr_IPAddress1", "135.251.45.76");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //180
            vmstore.DefaultEntryKey = "000000000004932";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "yang dong");
            server.SetEntry(vmstore, set);
            set.Clear();

            //181
            vmstore.DefaultEntryKey = "000000000004936";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "long yue");
            server.SetEntry(vmstore, set);
            set.Clear();

            //183
            vmstore.DefaultEntryKey = "000000000004946";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "yan b guo");
            set.Add("cChr_IPAddress1", "135.251.45.83");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //184
            vmstore.DefaultEntryKey = "000000000004947";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "long yue");
            server.SetEntry(vmstore, set);
            set.Clear();

            //185
            vmstore.DefaultEntryKey = "000000000004960";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "long yue");
            server.SetEntry(vmstore, set);
            set.Clear();

            //186
            vmstore.DefaultEntryKey = "000000000004956";
            set = new FieldValueSet();
            set.Add("cChr_IPAddress1", "135.251.45.86");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //194
            vmstore.DefaultEntryKey = "000000000004977";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "liang ji");
            server.SetEntry(vmstore, set);
            set.Clear();

            //197
            vmstore.DefaultEntryKey = "000000000004916";
            set = new FieldValueSet();
            set.Add("cChr_IPAddress1", "135.251.46.10");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //198
            vmstore.DefaultEntryKey = "000000000004913";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "richard qu");
            server.SetEntry(vmstore, set);
            set.Clear();

            //199
            vmstore.DefaultEntryKey = "000000000004905";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "richard qu");
            set.Add("cChr_IPAddress1", "135.251.46.12");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //200
            vmstore.DefaultEntryKey = "000000000004900";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "richard qu");
            set.Add("cChr_IPAddress1", "135.251.46.13");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //201
            vmstore.DefaultEntryKey = "000000000004901";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "richard qu");
            set.Add("cChr_IPAddress1", "135.251.46.14");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //202
            vmstore.DefaultEntryKey = "000000000004917";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "richard qu");
            set.Add("cChr_IPAddress1", "135.251.46.15");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();            
            
            //203
            vmstore.DefaultEntryKey = "000000000004902";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "richard qu");
            set.Add("cChr_IPAddress1", "135.251.46.16");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();            
            
            //204
            vmstore.DefaultEntryKey = "000000000004904";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "richard qu");
            set.Add("cChr_IPAddress1", "135.251.46.17");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();            
            
            //205
            vmstore.DefaultEntryKey = "000000000004919";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "richard qu");
            set.Add("cChr_IPAddress1", "135.251.46.18");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //206
            vmstore.DefaultEntryKey = "000000000004921";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "richard qu");
            set.Add("cChr_IPAddress1", "135.251.46.19");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();  
            
            //207
            vmstore.DefaultEntryKey = "000000000004903";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "chang Bo");
            set.Add("cChr_IPAddress1", "135.251.46.20");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //208
            vmstore.DefaultEntryKey = "000000000004923";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "richard qu");
            set.Add("cChr_IPAddress1", "135.251.46.21");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //209
            vmstore.DefaultEntryKey = "000000000004952";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "richard qu");
            set.Add("cChr_IPAddress1", "135.251.46.22");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();            
            
            //210
            vmstore.DefaultEntryKey = "000000000005302";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "richard qu");
            set.Add("cChr_IPAddress1", "135.251.46.24");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            
            //211
            vmstore.DefaultEntryKey = "000000000004980";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "yan b guo");
            server.SetEntry(vmstore, set);
            set.Clear();

            //212
            vmstore.DefaultEntryKey = "000000000004963";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "yan b guo");
            server.SetEntry(vmstore, set);
            set.Clear();

            //213
            vmstore.DefaultEntryKey = "000000000004968";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "yan b guo");
            server.SetEntry(vmstore, set);
            set.Clear();

            //214
            vmstore.DefaultEntryKey = "000000000004964";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "yan b guo");
            server.SetEntry(vmstore, set);
            set.Clear();


            //215
            vmstore.DefaultEntryKey = "000000000004795";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "xingshuang he");
            server.SetEntry(vmstore, set);
            set.Clear();


            //216
            vmstore.DefaultEntryKey = "000000000004798";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "xingshuang he");
            server.SetEntry(vmstore, set);
            set.Clear();


            //219
            vmstore.DefaultEntryKey = "000000000004911";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "liang ji");
            set.Add("cChr_IPAddress1", "135.251.44.140");
            set.Add("cChr_ResourcepoolID", "000000000002905");
            set.Add("cChr_ResourcePoolDisplay", "ASB_PRD");
            set.Add("tmp_Type", "PRD");
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //222
            vmstore.DefaultEntryKey = "000000000004988";
            set = new FieldValueSet();
            set.Add("cChr_Owner", "yan b guo");
            server.SetEntry(vmstore, set);
            set.Clear();



            

            //101
            vmstore.DefaultEntryKey = "000000000005003";
            set = new FieldValueSet();
            set.Add("Disabled", 1);
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //102
            vmstore.DefaultEntryKey = "000000000005004";
            set = new FieldValueSet();
            set.Add("Disabled", 1);
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();


            //103
            vmstore.DefaultEntryKey = "000000000005005";
            set = new FieldValueSet();
            set.Add("Disabled", 1);
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();


            //129
            vmstore.DefaultEntryKey = "000000000004987";
            set = new FieldValueSet();
            set.Add("Disabled", 1);
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //130
            vmstore.DefaultEntryKey = "000000000004986";
            set = new FieldValueSet();
            set.Add("Disabled", 1);
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //165
            vmstore.DefaultEntryKey = "000000000004915";
            set = new FieldValueSet();
            set.Add("Disabled", 1);
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //182
            vmstore.DefaultEntryKey = "000000000004938";
            set = new FieldValueSet();
            set.Add("Disabled", 1);
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //183
            vmstore.DefaultEntryKey = "000000000004946";
            set = new FieldValueSet();
            set.Add("Disabled", 1);
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //217
            vmstore.DefaultEntryKey = "000000000004909";
            set = new FieldValueSet();
            set.Add("Disabled", 1);
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();


            //218
            vmstore.DefaultEntryKey = "000000000004924";
            set = new FieldValueSet();
            set.Add("Disabled", 1);
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            //221
            vmstore.DefaultEntryKey = "000000000004927";
            set = new FieldValueSet();
            set.Add("Disabled", 1);
            set.Add("Short_Description", DateTime.Now.ToString());
            server.SetEntry(vmstore, set);
            set.Clear();

            server.LogOut();
            
        }


        [TestMethod]
        public void ASB_IPRagenInit()
        {
            IARServer server = ARServerFactory.CreateARServer();
            server.LogIn(new ARLogInRequestContext
            {
                UserName = "parkerz.admin",
                Server = "vs31ar03",
                Password = "admin",
                Authentication = string.Empty
            });

            for (int i = 1; i <= 255; i++)
            { 
                ASB_IPRange ip = new ASB_IPRange();
                ip.cInt_IP = i;
                ip.Short_Description = "ASB_IPRange";
                ip.Status = "New";
                ip.Submitter = "parkerz.admin";
                server.CreateEntry(ip);
            }
            server.LogOut();
        }


    }
}

